
#include <bits/stdc++.h>
const int N = 1e6 + 10;
using namespace std;
int n,m;
int a[N];
int b_s(int cur)
{
	int l = 1, r = n;
	while(l < r)
	{
		int mid = l + r >> 1;
		if(a[mid] < cur)l = mid + 1;
		else if(a[mid] > cur) r = mid;
		else return mid;
	}
	return 0;
}
void slove()
{
	cin >> n;
	for(int i = 1;i <= n;i++)cin >> a[i];
	cin >> m;
	if(b_s(m)) puts("YES");
	else puts("NO");
}
int main() {
	int T = 1;
	//cin >> T;
	while(T--)slove();



	return 0;
}

